package com.vivek.guess.what.calculation;

import java.util.List;
import java.util.Map;
import java.util.Set;

import com.vivz.guess.what.type.Position;
import com.vivz.guess.what.vo.Guess;

/**
 * 1. Update the definite outsiders FIRST
 * 
 * If the weight is zero, remove all the characters from the probability map or make their probability zero.
 */
public class ZeroWeightCalculation extends AbstractCalculation {

	@Override
	public void calculate(List<Guess> guesses, Map<Character, Set<Position>> probabilityMap) {

		if (isInputValid(guesses, probabilityMap)) {
			Guess lastGuess = guesses.get(guesses.size() - 1);
			if (lastGuess.getClue().hasDash()) {
				for (Character ch : lastGuess.getWord().toCharArray()) {
					probabilityMap.remove(ch);
				}
			}
		}

		removeEmptyPositionSets(probabilityMap);
	}

}
